From: Dongxiao Xu Date: Mon, 4 Feb 2013 11:07:34 +0000 (+0100) Subject: nEPT: fix EPT pointer setting for L2 guest X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~7323 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=ed11108c8f34ae52daa36c367beeedb7a1740a57;p=xen.git nEPT: fix EPT pointer setting for L2 guest Each time in virtual_vmentry(), the code needs to cover both EPT and shadow mode for L2 guest, updating different EPT pointer to shadow VMCS. This fixes the issue that, launch a guest with EPT, then kill it and launch a second guest with shadow, the second guest will hang at the startup screen. Signed-off-by: Dongxiao Xu Acked by: Eddie Dong Committed-by: Jan Beulich --- diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c index b47c940295..cf4d52096f 100644 --- a/xen/arch/x86/hvm/vmx/vvmx.c +++ b/xen/arch/x86/hvm/vmx/vvmx.c @@ -1076,6 +1076,14 @@ uint64_t get_shadow_eptp(struct vcpu *v) return ept_get_eptp(ept); } +static uint64_t get_host_eptp(struct vcpu *v) +{ + struct domain *d = v->domain; + struct ept_data *ept_data = &p2m_get_hostp2m(d)->ept; + + return ept_get_eptp(ept_data); +} + static bool_t nvmx_vpid_enabled(struct nestedvcpu *nvcpu) { uint32_t second_cntl; @@ -1159,6 +1167,8 @@ static void virtual_vmentry(struct cpu_user_regs *regs) /* Setup virtual ETP for L2 guest*/ if ( nestedhvm_paging_mode_hap(v) ) __vmwrite(EPT_POINTER, get_shadow_eptp(v)); + else + __vmwrite(EPT_POINTER, get_host_eptp(v)); /* nested VPID support! */ if ( cpu_has_vmx_vpid && nvmx_vpid_enabled(nvcpu) )